package ch04.home;

class Exercise4_04 {
	public static void main(String[] args) {
		int sum = 0;
		int s = 1; // sign(+/-)
		int num = 0;
		
		for (int i = 1; sum<100; i++, s = -s) {
			num = s * i;
			sum += num;			
		}
		System.out.println("num=" + num);
		System.out.println("sum=" + sum);
	}
}
/*
num=199
sum=100
*/